{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "compute arch: 8.6\n"
     ]
    }
   ],
   "source": [
    "import tvm\n",
    "# 获取当前设备信息\n",
    "dev = tvm.device(\"cuda\", 0)\n",
    "print(\"compute arch:\", dev.compute_version)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "SM:  48\n",
      "shared_memory:  48.0 KB\n",
      "max_clock_rate:  1.56 Ghz\n",
      "warp_size:  32\n",
      "FP32 flops:  19169.28\n"
     ]
    }
   ],
   "source": [
    "# A4000\n",
    "print(\"SM: \", dev.multi_processor_count)\n",
    "print(\"shared_memory: \", dev.max_shared_memory_per_block / 1024, \"KB\")\n",
    "print(\"max_clock_rate: \", dev.max_clock_rate/1e6, \"Ghz\")\n",
    "print(\"warp_size: \", dev.warp_size)\n",
    "\n",
    "print(\"FP32 flops: \",  dev.multi_processor_count*64*dev.max_clock_rate/1e6*2*2)\n",
    "\n",
    "# 4352 个shaders\n",
    "# 68*64*1.71*2 *2 = 29 的FP32性能  "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "develop",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.15 (default, Nov 24 2022, 15:19:38) \n[GCC 11.2.0]"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "49c5c5b872b9eeacbd5dc4458b94c3cdd4e416ed3e2360279bed59bc98a8aac1"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
